package com.jie.deletefile.PullToZoomListView;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.AbsListView;
import android.widget.ImageView;

import com.jie.deletefile.R;

import java.util.ArrayList;
import java.util.List;

public class PullListActivity extends AppCompatActivity {

    private List<String> datas;
    private PullToZoomListView pull;
    private PullAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pull_list);
        datas = getDatas();
        Log.e("TAG", "onCreate: "+datas.size());
        initView();
    }

    private void initView() {
        pull = (PullToZoomListView) findViewById(R.id.pull);
        Log.e("TAG", "initView: data"+datas.size() );
        adapter = new PullAdapter(this,datas, R.layout.item_pull);
        pull.setAdapter(adapter);
        pull.getHeaderView().setImageResource(R.drawable.a2);
        pull.getHeaderView().setScaleType(ImageView.ScaleType.CENTER_CROP);
        pull.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {

            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

            }
        });

    }

    private List<String> getDatas() {
        List<String> strings = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            strings.add("条目" + i);
        }
        return strings;
    }



}
